<?php echo html::script('media/js/validate_register.js')."\n" ?>
<?php
echo "<span id=\"check_edit\" style=\"display:none;\">".$check_edit."</span>\n";
//echo "<script>alert(".$check_edit.")</script>";
if(isset($post['email'])) $email = $post['email'];
else if(isset($data)) $email = $data->email;
else $email = '';
if(isset($post['imie'])) $imie = $post['imie'];
else if(isset($data)) $imie = $data->profiles->imie;
else $imie = '';
if(isset($post['nazwisko'])) $nazwisko = $post['nazwisko'];
else if(isset($data)) $nazwisko = $data->profiles->nazwisko;
else $nazwisko = '';
if(isset($post['password'])) $password = $post['password'];
else $password = '';
if(isset($post['password_confirm'])) $password_confirm = $post['password_confirm'];
else $password_confirm = '';
?>

<div id="panel-content">
<?php echo form::open('admin/edituser/'.$user,array('id'=>'registerform'))."\n" ?>
<h3>Dane osobowe</h3>
<table class="login-table" style="clear:both;margin-bottom:10px;">
	<tr>
		<td class="label">Imię</td>
		<td><?php echo form::input('imie', $imie,array('class'=>'input-text','size'=>'40')) ?></td>
		<td class="error"><?php echo (empty ($errors['imie'])) ? '' : $errors['imie']; ?></td>
	</tr>
	<tr>
		<td class="label">Nazwisko</td><td><?php echo form::input('nazwisko', $nazwisko,array('class'=>'input-text','size'=>'40')) ?></td>
		<td class="error"><?php echo (empty ($errors['nazwisko'])) ? '' : $errors['nazwisko']; ?></td>
	</tr>
	<tr>
		<td class="label">E-mail *</td><td><?php echo form::input('email', $email,array('id'=>'email','class'=>'required email input-text','size'=>'40')) ?></td>
		<td class="error"><?php echo (empty ($errors['email'])) ? '' : $errors['email']; ?></td>
	</tr>
</table>
<h3>Hasło</h3>
<?php if($user != 'new'): ?>
<div>Aby nie zmieniać hasła, pozostaw oba pola puste</div>
<?php endif ?>
<table class="login-table">
	<tr>
		<td class="label">Hasło *</td>
		<td><?php echo form::password('password', $password,array('id'=>'passwordus','size'=>'40','class'=>'input-text','autocomplete'=>'off')) ?></td>
		<td class="error"><?php echo (empty ($errors['password'])) ? '' : $errors['password']; ?></td>
		<td id="result"></td>
	</tr>
	<tr>
		<td>Potwierdź hasło *</td>
		<td><?php echo form::password('password_confirm', $password_confirm,array('id'=>'password_confirm','size'=>'40','class'=>'input-text')) ?></td>
		<td class="error"><?php echo (empty ($errors['password_confirm'])) ? '' : $errors['password_confirm']; ?></td>
		<td></td>
	</tr>
</table>
<tr>
	<td><span id="submit-sending"><input type="submit" value="zapisz" /></span></td>
	<td></td>
	<td><span id="submit-error"></span></td>
	<td></td>
</tr>
<?php echo form::close() ?>
</div>